package cn.zyx.service.impl;

import cn.zyx.dao.VipDao;
import cn.zyx.entity.Oil;
import cn.zyx.dao.OilDao;
import cn.zyx.entity.Vip;
import cn.zyx.service.OilService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Oil)表服务实现类
 *
 * @author makejava
 * @since 2022-01-03 15:43:20
 */
@Service("oilService")
public class OilServiceImpl extends ServiceImpl<OilDao, Oil> implements OilService {
    @Resource
    private OilDao oilDao;

    @Override
    public List<Oil> querynumber(String number) {
        return this.oilDao.querynumber(number);
    }

    @Override
    public List<Oil> queryopenId(String openid) {
        return this.oilDao.queryopenId(openid);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Oil queryById(Integer id) {
        return this.oilDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<Oil> queryAllByLimit(int offset, int limit,String dphone,String oilname, String dmoney,String dstatus,String start_date,String end_date) {
        return this.oilDao.queryAllByLimit(offset, limit, dphone, oilname,  dmoney, dstatus, start_date, end_date);
    }
    /**
     * 新增数据
     *
     * @param oil 实例对象
     * @return 实例对象
     */
    @Override
    public Oil insert(Oil oil) {
        this.oilDao.insert(oil);
        return oil;
    }

    /**
     * 修改数据
     *
     * @param oil 实例对象
     * @return 实例对象
     */
    @Override
    public Oil update(Oil oil) {
        this.oilDao.update(oil);
        return this.queryById(oil.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.oilDao.deleteById(id) > 0;
    }
}